﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using JobToDdd.Application.JobApp;
using JobToDdd.Application.JobApp.Dto;
using JobToDdd.Application.RequirementApp;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace JobToDdd.Api.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class JobController : ControllerBase
    {
        private readonly IJobService _jobService;
        private readonly IRequirementService _requirementService;

        public JobController(IJobService jobService, IRequirementService requirementService)
        {
            _jobService = jobService;
            _requirementService = requirementService;
        }

        [HttpGet]
        public async Task<Dictionary<string, object>> Get()
        {
            var dicRes = new Dictionary<string, object>();
            var jobsViews = await _jobService.GetJobDtos();
            var requriements = await _requirementService.GetRequriementDtos();

            dicRes.Add("jobViews", jobsViews);
            dicRes.Add("requriementViews", requriements);
            return dicRes;
        }
    }
}
